<?php

namespace app\admin\controller\session;

use app\admin\service\SessionService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use think\APP;
use think\Request;

/**
 * Session 控制器
 * Class Session
 * @package app\session\controller
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 */
class Session
{
    private Request $request;
    private SessionService $service;

    public function __construct(Request $request, SessionService $sessionService)
    {
        $this->service = $sessionService;
        $this->request = $request;
    }

    /**
     * 管理员登录
     * @return ApiResponse
     * @url /session/session/save
     */
    public function save(): ApiResponse
    {
        $request = $this->request;

        $data = $this->service->add($request->param());

        return ApiResponse::success($data);
    }

}
